package com.czkt.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.czkt.entity.SysUser;
import com.czkt.entity.vo.UserRole;
import com.czkt.mapper.SysUserMapper;
import com.czkt.service.ISysUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2024-06-18
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
    @Resource
    private SysUserMapper sysUserMapper;

    @Override
    public UserRole selectSysUser(String usrName, String usrPassword) {
        return sysUserMapper.selectSysUser(usrName, usrPassword);
    }

    @Override
    public UserRole selectRoleUser(String usrName) {
        return sysUserMapper.selectRoleUser(usrName);
    }

    @Override
    public UserRole selectUsrId(String usrId) {
        return sysUserMapper.selectUsrId(usrId);
    }

    @Override
    public void toUpdateUser(SysUser sysUser) {
        sysUserMapper.toUpdateUser(sysUser);
    }

    @Override
    public void deleteByUsrId(String usrId) {
        sysUserMapper.deleteByUsrId(usrId);
    }

    @Override
    public void toInsertUser(SysUser sysUser) {
        sysUserMapper.toInsertUser(sysUser);
    }

    @Override
    public IPage<UserRole> selectUserAndRole( String usrName, Long roleId, Integer pageIndex, Integer pageSize) {
        Page<UserRole> page = new Page<>(pageIndex,pageSize);
        return sysUserMapper.selectUserAndRole(page,usrName,roleId);
    }



}
